class HotelRoomTypeImagesController < ApplicationController
  # GET /hotel_room_type_images
  # GET /hotel_room_type_images.json

  layout 'admin'
  
  def index
    @hotel_room_type_images = HotelRoomTypeImage.where('hotel_room_type_id =?', params[:hrt])
    @hotel_room_type_image = HotelRoomTypeImage.new

    respond_to do |format|
      format.js { render layout: false }
    end
  end

  # GET /hotel_room_type_images/1
  # GET /hotel_room_type_images/1.json
  def show
    @hotel_room_type_image = HotelRoomTypeImage.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @hotel_room_type_image }
    end
  end

  # GET /hotel_room_type_images/new
  # GET /hotel_room_type_images/new.json
  def new
    @hotel_room_type_image = HotelRoomTypeImage.new

    respond_to do |format|
      format.js { render layout: false }
    end
  end

  # GET /hotel_room_type_images/1/edit
  def edit
    @hotel_room_type_image = HotelRoomTypeImage.find(params[:id])
  end

  # POST /hotel_room_type_images
  # POST /hotel_room_type_images.json
  def create
    @hotel_room_type_image = HotelRoomTypeImage.new(params[:hotel_room_type_image])
    if @hotel_room_type_image.save
      @hrt = @hotel_room_type_image.hotel_room_type_id
      @data_check = true
    else
      @data_check = false
    end

    respond_to do |format|
      format.js { render layout: false }
    end
  end

  # PUT /hotel_room_type_images/1
  # PUT /hotel_room_type_images/1.json
  def update
    @hotel_room_type_image = HotelRoomTypeImage.find(params[:id])
    @hotel_image.update_attributes(params[:id])
    
    respond_to do |format|
      format.js { render layout: false }
    end
  end

  # DELETE /hotel_room_type_images/1
  # DELETE /hotel_room_type_images/1.json
  def destroy
    @hotel_room_type_image = HotelRoomTypeImage.find(params[:id])
    @tr_id = @hotel_room_type_image.id
    if @hotel_room_type_image.destroy
      @data_check = true
    else
      @data_check = false
    end


    respond_to do |format|
      format.js { render layout: false }
    end
  end
end
